<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="https://cdn.bootcss.com/jasmine/3.3.0/jasmine.min.css" rel="stylesheet">

    <script src="https://cdn.bootcss.com/jasmine/3.3.0/jasmine.min.js"></script>
    <script src="https://cdn.bootcss.com/jasmine/3.3.0/jasmine-html.min.js"></script>
    <script src="https://cdn.bootcss.com/jasmine/3.3.0/boot.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/axios/0.19.0-beta.1/axios.min.js"></script>
    <script src="https://cdn.bootcss.com/qs/6.6.0/qs.min.js"></script>

</head>
<body>

</body>
<script>

    var baseUrl = 'http://localhost:8081/api/user/launcher'
    jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000
    describe("单元测试", function () {
        var a;

        it("Jquery登陆验证", function (done) {
            a = true;
            $.ajax({
                url: baseUrl,
                method: "post",
                data: {
                    'telephone': '15639749320',
                    'password': '123456',
                },
                datatype: 'json',
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
                    'Accept': '*/*'
                },
                withCredentials: true
            }).
            then(function (data) {
                console.log('ajax',data)
                a = data
            })

            setTimeout(function () {
                expect(a.status).toEqual('success');
                done()
            }, 500)
        });

        it("axios登陆验证", function (done) {
            a = true;
            axios({
                url: baseUrl,
                method: "post",
                data: Qs.stringify({
                    'telephone': '15639749320',
                    'password': '123456',
                }),
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
                    'Accept': '*/*'
                },
                withCredentials: true
            }).
            then(function (data) {
                console.log('axios', data)
                a = data.data
            })

            setTimeout(function () {
                expect(a.status).toEqual('success');
                done()
            }, 500)
        });
    });

</script>
</html>
